﻿using System;
using Peak.Core;

namespace Peak.Web.Controllers.Models
{
  public class ProjectModel : ModelBase
  {
    public int ProjectId { get; set; }
    public string Name { get; set; }
    public string Vision { get; set; }
    public DateTime Start { get; set; }
    public DateTime End { get; set; }
    public string DefinitionOfDone { get; set; }
    public bool Default { get; set; }
    public double StoryPoints { get; set; }

    public ProjectModel() : base(()=>new ProjectModelValidator())
    {      
    }

    public ProjectModel(Project project,bool isDefault) : base(() => new ProjectModelValidator())
    {
      ProjectId = project.Id;
      Name = project.Name;
      Vision = project.Vision;
      Start = project.Start;
      End = project.End;
      DefinitionOfDone = project.DefinitionOfDone;
      Default = isDefault;      
      StoryPoints = project.StoryPoints;
    }

    

    public void Update(Project project)
    {
      project.Name = Name;
      project.Vision = Vision;
      project.Start = Start;
      project.End = End;
      project.DefinitionOfDone = DefinitionOfDone;
    }
  }
}
